package com.motu.monstercity.server.gate;

import com.motu.vertx.module.utility.toolset.TimeUtils;
import com.motu.vertx.module.utility.toolset.Tool;
import io.vertx.core.http.ServerWebSocket;

public class SessionInfo {
    private ServerWebSocket socket;
    private long connectTime;//链接的时间

    public SessionInfo(ServerWebSocket socket) {
        this.socket = socket;
        this.connectTime = TimeUtils.getCurTime();
    }

    public ServerWebSocket getSocket() {
        return socket;
    }

    public long getConnectTime() {
        return connectTime;
    }

    /***
     * 判断session是否超时
     * @return
     */
    public boolean isTimeOut() {
//		System.out.println("check timeOut "+Tool.getTimeFullStr(this.getConnectTime()));
        return TimeUtils.getTimeDiff(this.getConnectTime()) > 60;
    }

}
